package cn.com.jenson.util;


import org.apache.commons.lang3.RandomStringUtils;
import org.apache.logging.log4j.util.Strings;

import java.util.Objects;

/**
 * 字符串 类型工具
 */
public class StringUtil {

    /**
     * 随机字符串
     *
     * @param length 随机数长度
     * @return 随机字符串
     */
    public static String randomString(int length) {
        return RandomStringUtils.randomAlphabetic(length);
    }

    public static String coverPosition(String str, int length, int number) {
        return String.format("%"+str+length+"d",number);
    }

    public static Boolean isEmpty(String str) {
        if (Objects.isNull(str))
            return true;
        return Strings.isEmpty(str);
    }
}
